class Home():
  def __init__(self,address,area):
    self.address=address
    self.area=area
    self.freeArea=area
    self.furniture=[]
  def __str__(self):
    return f'房子位于{self.address},占地面积{self.area},剩余面积{self.freeArea},家具有{self.furniture}'
  def addFurniture(self,item):
    if(self.freeArea>=item.area):
      self.furniture.append(item.name)
    else:
      print("家具太大，剩余面积不足，无法容纳")

class Furniture():
  def __init__(self,name,area):
    self.name=name
    self.area=area
  def __str__(self):
    return f'家具名：{self.name},占地面积：{self.area}'  

bed=Furniture("双人床",1200)
jia1=Home("北京",1200)
jia1.addFurniture(bed)
sofa=Furniture("沙发",50)
jia1.addFurniture(sofa)
ball=Furniture("篮球场",1500)
jia1.addFurniture(ball)
print(jia1)

